import java.util.Scanner;

public class 面积 {
    public static void main(String[] args){
//        下面三条需要哪一条的时候再取消注释哪一条，括号里需要输入数据
//        System.out.println(sanjiaoxing2());
//        System.out.println(zhengfangxing2());
//        System.out.println(changfangxing2());
    }
//   无参无返
    public static void sanjiaoxing(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入三角形的底：");
        double a = scanner.nextDouble();
        System.out.println("请输入三角形的高：");
        double b = scanner.nextDouble();
        double area = a*b/2;
        System.out.println("三角形的面积为:"+area);
    }public static void zhengfangxing(){
        Scanner scanner =new Scanner(System.in);
        System.out.println("请输入正方形的边长：");
        double a = scanner.nextDouble();
        double area = a*a;
        System.out.println("正方形的面积为："+area);
    }public static void changfangxing(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("长方形的长为：");
        double a =scanner.nextDouble();
        System.out.println("长方形的宽为：");
        double b =scanner.nextDouble();
        double area = a*b;
        System.out.println("长方形的面积："+area);
//      有参无返
    }public static void sanjiaoxing1(double a,double b){
        System.out.println("三角形的面积为："+a*b/2);
    }public static void zhengfangxing1(double a){
        System.out.println("正方形的面积为:"+a*a);
    }public static void changfangxing1(double a,double b){
        System.out.println("长方形的面积为："+a*b);
    }
//    有参有返
    public static double sanjiaoxing2(double a,double b){
        return a*b/2;
    }public static double zhengfangxing2(double a) {
        return a*a;
    }
    public static double changfangxing2(double a,double b){
        return a*b;
    }
}
